
"""
:para: in_file  for yaml file for input
:para: out_file for json file will be converted to
:return:  True with no error or False with
"""
import yaml
import json
import sys
def convert(in_file,out_file):
    try:
        with open(in_file, 'r') as yaml_in, open(out_file, "w") as json_out:
            yaml_playload = yaml.safe_load(yaml_in)
            json.dump(yaml_playload,json_out,indent=4,ensure_ascii=False)
    except:
        return False
    return True

if __name__ == "__main__":
    #command line convert
    in_file = sys.argv[1]
    out_file = sys.argv[2]
    if convert(in_file,out_file):
        print(' perfect')
    else:
        print('error')

